
ITEM.base = "base_weapon"
ITEM.class = "arrow"
ITEM.label = "Arrow"
ITEM.description = "An arrow for use with a bow."
ITEM.weight = 1.5
ITEM.model = "models/mixerman3d/other/arrow.mdl"
ITEM.icon = "wintersurvival/icon_arrow"

ITEM.holdtype = "melee"
ITEM.viewmodel = {
	{
		bone = "ValveBiped.Bip01_R_Hand",
		model = "models/mixerman3d/other/arrow.mdl",
		pos = Vector(1,-1,-2.5),
		ang = Angle(0,90,180),
		color = Color(255,255,255,255),
	},
}
ITEM.cooldown = 1

//Weapon

function ITEM:onThink(pl)
end

function ITEM:onPrimary(pl)
	local GM = gmod.GetGamemode()
	local itemtab,inv = self:getDatTab(pl)
	
	if CLIENT or not itemtab then
		return
	end
	
	if (itemtab.lastused + self.cooldown) < CurTime() and pl:WSHas("arrow") then
		local ent = ents.Create("ws_arrow")
		ent:SetPos(pl:GetShootPos())
		ent:SetAngles(pl:EyeAngles())
		ent:SetModel("models/mixerman3d/other/arrow.mdl")
		ent:SetOwner(pl)
		timer.Simple(1,function()
			if IsValid(ent) then
				ent:SetOwner()
			end
		end)
		ent:Spawn()
		ent:GetPhysicsObject():ApplyForceCenter(pl:GetAimVector() * math.pow(22,3)) //Why are we using math.pow when we can use an accent? Meh.
		
		pl:WSGive("arrow",-1)
	end
end

function ITEM:onSecondary(pl)
end
